package com.xmuexp109.exp5.mapper;

import com.xmuexp109.exp5.model.orderItemPo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface orderItemPoMapper {


    @Insert("insert into order_item (id, order_id, goods_sku_id, \n" +
            "      quantity, price, discount, \n" +
            "      name, coupon_activity_id, be_share_id, \n" +
            "      gmt_create, gmt_modified)\n" +
            "    values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{goodsSkuId,jdbcType=BIGINT}, \n" +
            "      #{quantity,jdbcType=INTEGER}, #{price,jdbcType=BIGINT}, #{discount,jdbcType=BIGINT}, \n" +
            "      #{name,jdbcType=VARCHAR}, #{couponActivityId,jdbcType=BIGINT}, #{beShareId,jdbcType=BIGINT}, \n" +
            "      #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})")
    int insertOrderItem(orderItemPo record);

    int insert(orderItemPo record);

    @Select("select * from order_item where order_id=#{orderId}")
    List<orderItemPo> findOrderItem(@Param("orderId") Long orderId);
}


